// 不用重复造轮子
const inBrowser = typeof window !== 'undefined';
const hasProto = "__proto__" in {};
const UA  = inBrowser && window.navigator.userAgent.toLocaleLowerCase();
const isEdge = UA && /msie|trident|edg/.test(UA);
const isCrome = UA && /chrome\/\d+/.test(UA) && !isEdge;

const camelize = function (str){
    const camelizeRE = /-(\w)/g;
    return str.replace(camelizeRE,function(_,c){
        // console.log(_,c)
        return c ? c.toUpperCase() : ''
    })
}

module.exports =  {inBrowser,hasProto,UA,isEdge,isCrome,camelize};